# coding: utf-8

from .Graph import vertex_t
from vec2 import vec2
from typing import Sequence


# Object representing a vertex in the final layout.
class NodeAttr:
    u: vertex_t  # the corresponding vertex identifier
    pos: vec2  # the position in space
    size: float  # the radius

    def __init__(self):
        self.u = -1
        self.pos = vec2()
        self.size = 0.0


# Object representing an edge in the final layout.
class EdgeAttr:
    u: vertex_t
    v: vertex_t  # the vertex identifiers of endpoints of the corresponding edge
    # control points of the poly-line representing the edge
    points: Sequence[vec2]
    bidirectional: bool = False

    def __init__(self, u, v):
        self.u = u
        self.v = v
        self.points = []
        self.bidirectional = False


# Contains the parameters of the desired graph layout.
class GraphAttr:
    node_size: float = 15  # radius of all nodes
    node_dist: float = 50  # minimum distance between borders of 2 nodes
    # minimum distance between borders of nodes in 2 different layers
    layer_dist: float = 80
    # angle determining the point on the node where a loop connects to it
    loop_angle: float = 55
    loop_size: float = node_size  # distance which the loop extends from the node
